#line 1 "D:/Desktop/PSM/Coding dsPIC30F4011/Test uart/test_uart.c"
unsigned rx1;
unsigned short i, pos;
char lcdtext[33];
char lcd='x';

void main() {

 ADPCFG = 0xFFFF;
 TRISB=0;
 TRISD=0xff;
 Lcd_Custom_Config(&PORTB, 7,6,5,4, &PORTB, 0,1,2);

 Uart1_Init(9600);
 Uart1_Write_Char('s');

 delay_ms(100);
 i=0;

 while(1) {






 if (Uart1_Data_Ready())
 {
 lcdtext[i]=uart1_read_char();
 i++;
 if(i==40)
 {
 i=0;
 lcd_custom_cmd(lcd_return_home);

 for (pos=0;pos<40;pos++)
 {
 lcd_custom_chr_cp(lcdtext[pos]);
 if(pos==19)lcd_custom_cmd(lcd_second_row);
 }
 uart1_write_char('Y');
 }
 }
 }
 delay_ms(100);
}
